<?php

/**
 * @author 		Samuel Carlier
 * @package 	P3Base_Mailer
 * @subpackage 	P3Base_Mailer_Iterator
 */
class P3Base_Mailer_Iterator_MailFile extends P3Base_Iterator_Simple {

	/**
	 * @return string
	 */
	public function current() {
		$current = current($this->_array);

		$header  = 'Content-ID:<' .  $current['content_id'] . '>' . P3Base_Mailer_Handler_SMTP::CRLF;
		$header .= 'Content-Type:' .  $current['force_mime'] . ';' .  P3Base_Mailer_Handler_SMTP::CRLF;
		$header .= "\t" . 'name="' . $current['name'] . '"' . P3Base_Mailer_Handler_SMTP::CRLF;

		$header .= 'Content-Transfer-Encoding:' .  'base64' . P3Base_Mailer_Handler_SMTP::CRLF;
		
		$header .= 'Content-Disposition: attachment;' . P3Base_Mailer_Handler_SMTP::CRLF;
		$header .= "\t" . 'filename="' .  $current['name'] . '"' . P3Base_Mailer_Handler_SMTP::CRLF;
		
		return $header;
	}

	/**
	 * @return string
	 */
	public function key() {
		$current = current($this->_array);
		return $current['path'];
	}
}
?>